package com.bianmin.Controller;

import com.bianmin.Data.Result;
import com.bianmin.Data.ResultCode;
import com.bianmin.Mapper.FeedBackMapper;
import com.bianmin.Model.Feedback;
import com.bianmin.coomen.Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/feedBack")
public class FedBackController {

    @Autowired
    private FeedBackMapper mapper;

    //添加反馈
    @PostMapping("addFeedBack")
    public Result<Object> addFeedBack(@RequestBody Feedback feedBack) {
        feedBack.setCreateTime(Util.currentTimeString());
        int r = mapper.insert(feedBack);
        return r == 1 ? Result.success("反馈成功") : Result.error(ResultCode.RC1001);
    }



}
